#for 循环计数
a = 0
for i in range(1, 101):
    print(i)
    a += 1


#while 循环计数
counter = 0
while counter < 101:
    print(f"sim statement:{counter}")
    counter += 1


#斐波那契函数
#for 函数实现
def F(n):
    lst = []
    for i in range(n):
        if i == 0 or i == 1:
            lst.append(1)
        else:
            lst.append(lst[i - 1] + lst[i - 2])
    print(lst)

F(10)


#while 函数实现
def B(x):
    a, b = 1, 1
    n= 1
    while n <= x:
        result = a
        a, b = b, a + b
        n += 1
        yield result

# 调用函数返回值是一个生成器，使用for循环遍历取值
for i in B(11):
    print(i)


#自定义异常
def add(a, b): #加法运算
    return a + b


def subtract(c, d): #减法运算
    return c - d


def multiply(e, f): #乘法运算
    return e * f


def eliminates(g, h): #除法运算
    return g / h


def divide (o, p): #整除运算
    return o // p


def remainder(q, r): #取余运算
    return q % r


def sqr(s, t): #开方运算
    return s ** t


if __name__ == "__main__":
    result1 = add(5, 6)
    print(result1)

    result2 = subtract(5, 6)
    print(result2)

    result3 = multiply(5, 6)
    print(result3)

    result4 = eliminates(5, 6)
    print(result4)

    result5 = divide(5, 6)
    print(result5)

    result6 = remainder(5, 6)
    print(result6)

    result7 = sqr(5, 6)
    print(result7)